<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<script type="text/javascript" src="/finance/script/jquery.js"></script>
<script type="text/javascript" src="/finance/script/json2.js"></script>
<script type="text/javascript">
	 
	 $(document).ready(function(){
			$("#addbank").on("click", function(){
				$.ajax({
					"url":"/finance/bank/addaccount.do",//요청 url
					"data":{"custId":$("#acc").val() , "account" :$("#acc").val(),"bank":$("#bank").val()},//요청파라미터
					"type":"post",//요청방식
					"dataType":"json",//응답 데이터의 타입
					"beforeSend":function(){
						 if(!$("#bank").val()){
								alert("은행명을 입력해주세요");
								return false;
							}else if(!$("#acc").val()){
								alert("통장이름을 입력해주세요");
								return false;
							}
						},
					"success":function(data){
							alert(data);
						}
					});
				
					
			});
	 });
</script>
<body>
<table>
<tr>
<td>은행 :</td><td> <input type="text" name="bank" id="bank"> </td>
</tr>
<tr>
<td>통장이름 :</td><td> <input type="text" name="acc" id="acc"></td>
</tr>
</table>
<input type="button"  value="추가" id="addbank"><br>
</body>
</html>